#include "processbar.h"


char* spit = "-\\|/";

char buff[MAX] = {0};
void process_fflush(double rate)
{
    static int cnt = 0;
    int n = strlen(spit);
    if (rate < 0.5) buff[0] = Head;

    printf("[%-100s][%.1f%%][%c]\r", buff, rate, spit[cnt%n]);
    fflush(stdout);
    buff[(int)rate] = Body;
    if ((int)rate < 99) buff[(int)rate + 1] = Head;
    
    cnt++;

    if (rate >= 100.0) printf("\n");
}
